fix(capture): honor cancellation during screen-recording permission retry#280
fix(capture): honor cancellation during screen-recording permission retry#280SebTardif wants to merge 2 commits into
Conversation
…etry The permission probe retry slept with try?, so a canceled caller could still run a second SCShareableContent probe. Recheck cancellation after sleep and return false without another probe. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
|
Codex review: needs real behavior proof before merge. Reviewed July 17, 2026, 7:17 AM ET / 11:17 UTC. Summary Reproducibility: no. there is not yet a high-confidence real-environment reproduction. Source inspection clearly exposes the swallowed-cancellation path, but the PR does not exercise a live or focused production-helper cancellation during the ScreenCaptureKit retry. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the post-sleep guard, add focused cancellation regression coverage, provide redacted terminal or runtime evidence showing that cancellation suppresses the second probe, and leave Do we have a high-confidence way to reproduce the issue? No, there is not yet a high-confidence real-environment reproduction. Source inspection clearly exposes the swallowed-cancellation path, but the PR does not exercise a live or focused production-helper cancellation during the ScreenCaptureKit retry. Is this the best way to solve the issue? Yes, the immediate post-sleep cancellation check matches established repository patterns and is the narrowest correction. Merge readiness still requires direct behavior proof and removal of the release-owned changelog edit. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e2a46347138d. Label changesLabel justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
|
@clawsweeper re-review Removed the release-owned CHANGELOG entry. Added injectable probe seams, focused cancel/non-cancel regression tests (1 vs 2 probes), and a red/green terminal prove script showing unfixed burns a second SCShareableContent probe after cancel while fixed stops at one. PR body updated with live transcript. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Triage Wave 5 closeout: closing without merge, not requesting changes. This is the same swallowed-cancellation class as #279, at the adjacent The maintainer reconstruction confirmed the bug on current It cannot be merged under the required live-proof bar. On the available macOS host, the signed production GUI/on-demand paths timed out despite mandatory permissions reporting granted, and a current-Developer-ID-signed XCTest host could not get a real No commit was pushed and there is no merge SHA. Closing as overlap with #279 plus the same mandatory live-boundary blocker. Thanks @SebTardif for identifying the permission-probe sibling and adding targeted coverage. |
What Problem This Solves
Screen-recording permission probing in
ScreenRecordingPermissionCheckersleeps withtry? await Task.sleepafter a transient ScreenCaptureKit denial, then always runs a secondSCShareableContentprobe.try?swallowsCancellationError, so a canceled permission check can still burn a second SCK probe instead of returning promptly.Same cancel-swallow class as #279 / #271 / #270.
Evidence
Before
After
CHANGELOG.mdis left to the release process (removed from this PR per review).Live terminal transcript (after fix)
Production helper with injectable probe (commit on this branch):
Real behavior proof
Behavior or issue addressed: Canceling during the screen-recording permission transient-denial sleep must not run a second ScreenCaptureKit shareable-content probe.
Real environment tested: macOS 26.5.2 (Build 25F84), arm64, Peekaboo worktree on this PR branch, Swift 6.x.
Exact steps or command run after this patch:
swiftc -parse-as-library -o /tmp/prove-sck-perm scripts/prove-screencapture-permission-cancel.swift /tmp/prove-sck-perm swift test --package-path Core/PeekabooAutomationKit --filter ScreenRecordingPermissionCancelTestsEvidence after fix: Terminal transcript above: unfixed path runs 2 probes after cancel; fixed path stops at 1 probe in ~52ms and returns not-granted. Production
ScreenRecordingPermissionCheckerwith injected probe matches the same counts.Observed result after fix: Canceled permission checks return
falseafter one SCK probe. Non-cancelled transient denials still probe twice.What was not tested: Live TCC denial on a signed Peekaboo binary with real ScreenCaptureKit (requires denying Screen Recording in System Settings during a live capture). Delay length matches
ScreenCaptureKitTransientError(350ms).Summary
Task.isCancelledguard on the permission retry path.CHANGELOG.mdedit (release-owned).Related: #279, #271, #270